package it.cagiobox.fileutility.gui;

import javax.swing.table.AbstractTableModel;

class GridTableModel extends AbstractTableModel {
    private String[] _columnNames = null; 
    private Object[][] _data = null;


    public GridTableModel(String[] columnNames, Object[][] data){
    	_columnNames = columnNames;
    	_data = data;
    }
    
    public int getColumnCount() {
        return _columnNames.length;
    }

    public int getRowCount() {
        return _data.length;
    }

    public String getColumnName(int col) {
        return _columnNames[col];
    }

    public Object getValueAt(int row, int col) {
        return _data[row][col];
    }

    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }

    /*
     * Don't need to implement this method unless your table's
     * editable.
     */
    public boolean isCellEditable(int row, int col) {
            return false;
    }

    /*
     * Don't need to implement this method unless your table's
     * data can change.
     */
    public void setValueAt(Object value, int row, int col) {
        _data[row][col] = value;
        fireTableCellUpdated(row, col);
    }

}